import { register } from "../../utils/Layer";
import { BaseTileLayer } from './BaseTileLayer'

export class WmtsLayer extends BaseTileLayer {
  //构建ImageryProvider
  _createImageryProvider(options) {
    return createImageryProvider(options)
  }
}

function createImageryProvider(options) {

  if (options.crs == '4490') {
    options.tileMatrixLabels = [...Array(20).keys()].map((level) => (level + 1).toString())
  }
  return new Cesium.WebMapTileServiceImageryProvider(options)
}

WmtsLayer.createImageryProvider = createImageryProvider

//注册下
const layerType = 'wmts' //图层类型
register(layerType, WmtsLayer)
